const config = require('./webpack.config.js');
const webpack = require('webpack');
const path = require('path');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');


const bs = require('browser-sync').create();

config.entry.unshift('webpack-hot-middleware/client?reload=true');

let compiler = webpack(config);

let app = new (require('express'))();

app.use(webpackDevMiddleware(compiler,{publicPath:'/assets/'}));

app.use(webpackHotMiddleware(compiler));

app.get('/',(req,res)=> res.sendfile(path.resolve(__dirname,'src/index.html')));

let port = 9000;
app.listen(port);